include(../public.cmake)

project(JXQCore)

project_version_conf()

#-----------------------------------------------------------------------------------

include_directories(
	. meta container concurrent
	../../include)

set(HEADER_LIST
	jxqglobal.h
	jsingleton.h
	jdebug.h
	jflags.hpp
	jobject.h
	meta/jmetatype.h
	meta/jmetafunction.h
	meta/jmeta.h
	meta/jvariant.h
	meta/jmessage.h
	container/jcontainerbase.h
	container/jlist.hpp
	container/jstring.h
	container/jstringlist.hpp
	concurrent/jthread.h
	concurrent/jmutex.h
	concurrent/jthreadpool.h
	concurrent/jrunnable.h
	concurrent/jconcurrent.h
	concurrent/jtimer.h
	)

set(PRIVATE_HEADER_LIST
	concurrent/jthread_p.h
	)

list(APPEND SRC_LIST
	jdebug.cpp
	jobject.cpp
	meta/jmetatype.cpp
	meta/jmetafunction.cpp
	meta/jmeta.cpp
	meta/jvariant.cpp
	meta/jmessage.cpp
	container/jstring.cpp
	concurrent/jthread.cpp
	concurrent/jmutex.cpp
	concurrent/jthreadpool.cpp
	concurrent/jrunnable.cpp
	concurrent/jconcurrent.cpp
	concurrent/jtimer.cpp
	)

#-----------------------------------------------------------------------------------

if(WIN32)
	list(APPEND SRC_LIST concurrent/jthread_win.cpp)
elseif(UNIX)
	list(APPEND SRC_LIST concurrent/jthread_unix.cpp)
endif()

#-----------------------------------------------------------------------------------

FILE(GLOB_RECURSE G_HEADER_LIST ../../include/JXQCore/*)

add_library(${PROJECT_NAME} SHARED
	${SRC_LIST}
	${HEADER_LIST}
	${PRIVATE_HEADER_LIST}
	${G_HEADER_LIST}
	${VERSIONINFO_RC}
)

if(UNIX)
	target_link_libraries(${PROJECT_NAME} PUBLIC pthread)
endif()

#-----------------------------------------------------------------------------------

output_conf()

file(COPY ${HEADER_LIST} DESTINATION
	${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/include/JXQCore)

